#! /usr/bin/env python
# -*- coding: utf-8 -*-

# Copyright (c) JoinQuant Development Team
# Author: Huayong Kuang <kuanghuayong@joinquant.com>

from __future__ import print_function

import itertools

class Obj(object):

    __TOO = 1

    def __init__(self):
        self.a = 1
        self.b = 2

    def foo(self):
        pass

    def __getattr__(self, name):
        print("--in getattr, name: ", name)
        if name in ('k', 'h', 'y'):
            return 18

    def __dir__(self):
        print("-------------------", dir(self.__class__))
        return [k for k in itertools.chain(dir(self.__class__), self.__dict__, ['ccc'])]


o = Obj()
print(o.__dict__)
print(o.a, o.b)
print(o.k, o.h, o.y)
print(o.z)
print(dir(Obj))
print(dir(o))
